package cascade
{
	import cascade.controller.CascadeController;
	import cascade.model.CascadeModel;
	import cascade.view.CascadeView;
	
	import flight.net.RemoteService;
	
	public class App
	{
		protected static var _model:CascadeModel = new CascadeModel();
		protected static var _view:CascadeView = new CascadeView();
		protected static var _controller:CascadeController = new CascadeController();
		protected static var _busy:CascadeBusy = new CascadeBusy();
		protected static var _service:RemoteService;
		protected static var _debugService:RemoteService;
		
		public static function get model():CascadeModel
		{
			return _model;
		}
		
		public static function get view():CascadeView
		{
			return _view;
		}
		
		public static function get controller():CascadeController
		{
			return _controller;
		}
		
		public static function get busy():CascadeBusy
		{
			return _busy;
		}
		
		public static function get service():RemoteService
		{
			return view.debug ? _debugService : _service;
		}
		
		public static function setGateway(gateway:String):void
		{
			_service = new RemoteService(gateway);
			_debugService = new RemoteService(gateway + "?start_debug=1&debug_host=127.0.0.1&debug_port=10000&debug_stop=1");
		}
	}
}